<template>
	<view class="container">
		<TopBtn :title="'预约详情'"></TopBtn>
		<view class="info">
			<view class="currency_card jjBox" v-if="data.status==3">
				<view class="jjtitle flex-center">
					<image src="@/static/ConsultationRoom/del.png" mode="aspectFill"></image> 拒绝原因
				</view>
				<view class="">
					{{data.rejectReason}}
				</view>
			</view>
			<view class="currency_card">
				<view class="state">
					{{data.statusName}}
				</view>
				<view class="currency_title">
					预约信息
				</view>
				<view class="currency_info">
					<view class="Card_row">
						<view class="title">
							预约时间：
						</view>
						<view class="flex-center-center">
							<uni-dateformat :date="data.appointTime" format="yyyy-MM-dd"></uni-dateformat>
							<view v-if="data.status==1" class="state2 flex-center-center">{{data.flag}}</view>
						</view>
					</view>
					<view class="Card_row alignItems">
						<view class="title">
							预约医生：
						</view>
						<view class="">
							<doctorCard :data='data'></doctorCard>
						</view>
					</view>
					<view class="Card_row">
						<view class="title">
							就诊地址：
						</view>
						<view class="">
							{{data.adress}}
						</view>
					</view>
					<view class="Card_row">
						<view class="title">
							预约编号：
						</view>
						<view class="">
							{{data.no}}
						</view>
					</view>
					<view class="Card_row">
						<view class="title">
							提交时间：
						</view>
						<view class="">
							<uni-dateformat :date="data.createTime" format="yyyy-MM-dd hh:mm"></uni-dateformat>
						</view>
					</view>
				</view>
			</view>
			<patientCard :data="data"></patientCard>
			<view class="currency_card">
				<view class="currency_title ">
					病情资料
				</view>
				<view class="flex-center-center">
					<DiseaseCondition v-if="data.consultationFormRespVO" :data="data.consultationFormRespVO"></DiseaseCondition>
					<image class="qxt" v-else src="@/static/DefaultGraph/bqzl.png" mode=""></image>
				</view>
			</view>
			<!-- <view class="currency_card">
				<view class="currency_title">
					交易信息
				</view>
				<view class="currency_info">
					<view class="Card_row">
						<view class="title">
							付款金额：
						</view>
						<view class="red">
							￥100/2天
						</view>
					</view>
					<view class="Card_row">
						<view class="title">
							提交时间：
						</view>
						<view class="">
							2024-05-21 11:32
						</view>
					</view>
				</view>
			</view> -->
		</view>
		<view class="kong">

		</view>
		<view class="btnBoxTow" v-if="data.status==0">
			<view class="cancel" @click="openPup()">
				拒诊
			</view>
			<view class="confirm" @click="appointAudit(1)">
				同意
			</view>
		</view>
		<uni-popup ref="popup" type="bottom">
			<view class="pupbox">
				<view class="title">
					<view class="close" @click="closePup()">
						取消
					</view>
					拒绝原因
					<view class="add" @click="Submit()">
						确认
					</view>
				</view>
				<view class="">
					<textArea v-model="rejectReason" :inputNane="rejectReason" :maxNum="50"></textArea>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		getAppointInfo,
		appointAudit
	} from '@/api/ConsultationRoom'
	export default {
		data() {
			return {
				data: {},
				id: "",
				rejectReason: ""

			};
		},
		onLoad(e) {
			this.id = e.id
			this.getAppointInfo(e.id)
		},
		methods: {
			closePup() {
				this.$refs.popup.close()
				// this.data = {}
			},
			Submit() {
				if (!this.rejectReason) {
					uni.showToast({
						title: '请填写拒绝原因',
						duration: 2000,
						icon: 'none',
					})
					return
				}
				this.appointAudit(3)
				this.rejectReason = ""
				this.getAppointInfo(this.id)
				this.closePup()
			},
			openPup(e, id) {
				this.$refs.popup.open('bottom')
				this.rejectReason = ""
			},
			appointAudit(e) {
				appointAudit({
					id: this.id,
					status: e,
					rejectReason: this.rejectReason
				}).then(res => {
					uni.showToast({
						title: '操作成功',
						duration: 2000,
						icon: 'none',
					})
					this.getAppointInfo(this.id)
				})
			},
			getAppointInfo(e) {
				getAppointInfo({
					id: e
				}).then(res => {
					this.data = res.data
				})
			}
		}
	}
</script>

<style lang="less">
	.jjBox {
		font-weight: 500;
		font-size: 28rpx;
		color: #333333;

		.jjtitle {
			margin-bottom: 15rpx;
			font-weight: bold;
			font-size: 32rpx;
			color: #333333;

			image {
				width: 33rpx;
				height: 33rpx;
			}
		}
	}

	.state2 {
		width: 86rpx;
		height: 33rpx;
		border-radius: 10rpx;
		border: 1px solid #3E6EFE;
		font-weight: 500;
		font-size: 22rpx;
		margin-left: 15rpx;
		color: #3E6EFE !important;
	}

	.pupbox {
		width: 750rpx;
		height: 522rpx;
		background: #ffffff;
		border-radius: 50rpx 50rpx 0rpx 0rpx;
		padding: 30rpx 50rpx;
		box-sizing: border-box;
		background-size: 100% 100%;

		.title {
			font-size: 36rpx;
			font-weight: bold;
			color: #333333;
			position: relative;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.add {
				font-weight: 500;
				font-size: 28rpx;
				color: #3E6EFE
			}

			.close {
				font-weight: 500;
				font-size: 28rpx;
				color: #999999;
			}

		}

		.messageList {
			margin-top: 1em;

			margin-top: 1em;

			.scroll-view_H {
				white-space: nowrap;
				width: 100%;
			}

			.messageinfo {
				display: inline-block;
				width: 287rpx;
				height: 220rpx;
				border: 2px solid #eeeeee;
				border-radius: 15rpx;
				margin-right: 25rpx;
				padding: 20rpx;
				box-sizing: border-box;
				font-size: 26rpx;
				font-weight: 500;
				color: #999999;
				vertical-align: top;
			}

			.text {
				height: 100%;
				display: flex;
				align-items: center;
				white-space: wrap;
				white-space: pre-wrap;
				/* css-3 */
				white-space: -moz-pre-wrap;
				/* Mozilla, since 1999 */
				white-space: -pre-wrap;
				/* Opera 4-6 */
				white-space: -o-pre-wrap;
				/* Opera 7 */
				word-wrap: break-word;
				/* Internet Explorer 5.5+ */
			}

			.act {
				border: 4rpx solid #aa75fa;
				color: #7e67fd;
			}
		}

		// 多行文本输入框
		/deep/.uni-easyinput__content {
			border: none;
		}

		// 多行文本输入框
		/deep/.is-textarea {
			background-color: #f9f9f9 !important;
			margin: 23rpx 0 40rpx;

		}

		/deep/.is-input-border {
			border-radius: 20rpx;
		}

		/deep/.uni-easyinput__placeholder-class {
			font-size: 28rpx;
		}
	}

	.info {
		padding: 30rpx;

		.currency_card {
			position: relative;

			.state {
				position: absolute;
				right: 0;
				top: 0;
				padding: 0 5rpx;
				min-width: 100rpx;
				height: 50rpx;
				background: #F9FBFE;
				font-size: 28rpx;
				color: #3E6EFE;
				text-align: center;
				line-height: 50rpx;
				border-radius: 0 21rpx;
			}
		}

		&>view {
			margin-bottom: 27rpx;
		}

		.currency_info {
			margin-top: 21rpx;

			&:last-child {
				margin-top: 0rpx;
			}


			.Card_row {
				display: flex;
				font-weight: 500;
				font-size: 28rpx;
				color: #333;
				align-items: center;
				min-height: 50rpx;

				.title {
					width: 150rpx;
					color: #999;
				}
			}

			.alignItems {
				align-items: self-start;
			}
		}

	}
</style>